<template>
  <div>
    <el-date-picker
      :disabled="formData.id && item.disabled"
      v-model="modelData"
      :placeholder="item.placeholder || '选择时间'"
      :type="item.type"
      :start-placeholder="item.splaceholder || '开始时间'"
      :end-placeholder="item.eplaceholder || '结束时间'"
      value-format="yyyy-MM-dd HH:mm:ss"
      class="filter-item"
      @change="datepickerChange"
      clearable
    ></el-date-picker>
  </div>
</template>

<script>
export default {
  name: "datapickerpart",
  props: {
    formData: {
      type: Object,
      default() {
        return {};
      }
    },
    item: {
      type: Object,
      default() {
        return {};
      }
    },
    vModel: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      selectData: [],
      modelData: []
    };
  },
  created() {},
  watch: {
    vModel(newValue) {
      if (newValue) {
        this.modelData = this.vModel;
      }
    }
  },
  methods: {
    datepickerChange() {
      if (this.modelData && this.modelData.length > 0) {
        this.$emit("datepickerChange", this.modelData);
      }
    }
  }
};
</script>
<style scoped>
</style>
